import os
from utils import load_env_file, run_script, run_script_async

SCRIPT_DIR = os.path.abspath("scripts")
ENV_PATH = os.path.join(SCRIPT_DIR, "config.env")
env_vars = load_env_file(ENV_PATH)

def call_script(name):
    script_path = os.path.join(SCRIPT_DIR, name)
    return run_script(script_path, env_vars)

def call_script_async(name):
    script_path = os.path.join(SCRIPT_DIR, name)
    return run_script_async(script_path, env_vars)

def status():
    return call_script("status.sh")

def restart():
    return call_script_async("restart.sh")

def stop():
    return call_script("stop.sh")

def update():
    return call_script("update.sh")

def backup():
    return call_script("backup.sh")

def start():
    return call_script_async("start.sh")